<?php

namespace App;

use App\Model\Blog;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'username', 'email', 'password','email_token'
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
         'remember_token',
    ];

//用户模型关联blog模型方法
//关系是:用户表对blog表是一对多的关系

public function blog(){
    return $this->hasMany(Blog::class,'user_id','id');
}

}
